package com.liangzhong.facade
{
	import com.adobe.webapis.youtube.Friend;
	import com.liangzhong.constants.ApplicationConstants;
	import com.liangzhong.controller.StartupCommand;
	import com.liangzhong.facade.activity.ActivityFacade;
	import com.liangzhong.facade.bag.BagFacade;
	import com.liangzhong.facade.chat.ChatFacade;
	import com.liangzhong.facade.club.ClubFacade;
	import com.liangzhong.facade.compete.CompeteFacade;
	import com.liangzhong.facade.court.CourtFacade;
	import com.liangzhong.facade.explore.ExploreFacade;
	import com.liangzhong.facade.fameHall.FameHallFacade;
	import com.liangzhong.facade.friend.FriendFacade;
	import com.liangzhong.facade.goldpalace.GoldPalaceFacade;
	import com.liangzhong.facade.guess.GuessFacade;
	import com.liangzhong.facade.guide.GuideFacade;
	import com.liangzhong.facade.ladderMatch.LadderMatchFacade;
	import com.liangzhong.facade.leagueMatch.LeagueMatchFacade;
	import com.liangzhong.facade.mail.MailFacade;
	import com.liangzhong.facade.match.MatchFacade;
	import com.liangzhong.facade.playerCenter.PlayerCenterFacade;
	import com.liangzhong.facade.rankinglist.RankinglistFacade;
	import com.liangzhong.facade.shop.ShopFacade;
	import com.liangzhong.facade.talent.TalentFacade;
	import com.liangzhong.facade.task.TaskFacade;
	import com.liangzhong.facade.techBar.TechBarFacade;
	import com.liangzhong.facade.trainingcamp.TrainingcampFacade;
	import com.liangzhong.facade.user.UserFacade;
	import com.liangzhong.facade.winebar.WinebarFacade;
	import com.liangzhong.facade.youngTrain.YoungTrainFacade;
	import com.liangzhong.modules.Main.command.LogicCommand;
	import com.liangzhong.modules.login.command.LoginCommand;
	import com.liangzhong.proxy.login.LoginProxy;
	
	import org.puremvc.as3.patterns.facade.Facade;

	/**
	 * 主facade
	 * @author lxh
	 * 
	 */	
	public class GameFacade extends Facade
	{
		public static const STARTUP:String = "startup";
		public static var instance:GameFacade;
		
		public function GameFacade()
		{
			super();
		}
		
		public static function getInstance():GameFacade
		{
			if (instance == null)
			{
				instance = new GameFacade();
			}
			return instance as GameFacade;
		}
		
		override protected function initializeModel():void
		{
			super.initializeModel();
			
		}
		override protected function initializeView():void
		{
			super.initializeView();
		}
		override protected function initializeController():void
		{
			super.initializeController();
			
			//startup----appllication init
			this.registerCommand(STARTUP,StartupCommand);
			/******************************  Login   ***********************************************/
			this.registerCommand(ApplicationConstants.Login_TGW,LoginCommand);
			//登陆信息
			this.registerCommand(ApplicationConstants.Login_login,LoginCommand);
			this.registerCommand(LoginProxy.Login_Result,LoginCommand);
			//签到
			this.registerCommand(ApplicationConstants.Login_Get_SignInfo,LoginCommand);
			this.registerCommand(ApplicationConstants.Login_User_Sign,LoginCommand);
			this.registerCommand(ApplicationConstants.Login_User_Resign,LoginCommand);
			this.registerCommand(ApplicationConstants.Login_User_Get_Sign_Award,LoginCommand);
			//qzone award
			this.registerCommand(ApplicationConstants.Login_User_Get_Qzone_Vip_Award,LoginCommand);
			/******************************  公共   ***********************************************/
			this.registerCommand(ApplicationConstants.Public_Drop_Time,LogicCommand);
			this.registerCommand(ApplicationConstants.Public_Match_Get_Award,LogicCommand);
			this.registerCommand(ApplicationConstants.Public_Club_Get_Award_list,LogicCommand);
			/******************************* User  ********************************************/
			var userFacade :UserFacade = new UserFacade();
			userFacade.facade = this;
			userFacade.initializeController();
			/******************************* Guide  ********************************************/
			var guideFacade :GuideFacade = new GuideFacade();
			guideFacade.facade = this;
			guideFacade.initializeController();
			/******************************* Match  ********************************************/
			var matchFacade :MatchFacade = new MatchFacade();
			matchFacade.facade = this;
			matchFacade.initializeController();
			/**********背包********/
			var bagFacade :BagFacade = new BagFacade();
			bagFacade.facade = this;
			bagFacade.initializeController();
			/**********俱乐部********/
			var clubFacade:ClubFacade = new ClubFacade();
			clubFacade.facade = this;
			clubFacade.initializeController();
			/**********球员中心********/
			var palyercenterFacad:PlayerCenterFacade = new PlayerCenterFacade();
			palyercenterFacad.facade = this;
			palyercenterFacad.initializeController();
			/**********邮件********/
			var mailFacade :MailFacade = new MailFacade();
			mailFacade.facade = this;
			mailFacade.initializeController();
			/**********酒吧********/
			var winebarFacade :WinebarFacade = new WinebarFacade();
			winebarFacade.facade = this;
			winebarFacade.initializeController();
			/**********青训营********/
			var youngTrainFacade :YoungTrainFacade = new YoungTrainFacade();
			youngTrainFacade.facade = this;
			youngTrainFacade.initializeController();
			/*********训练营************/
			var trainingcampFacade :TrainingcampFacade = new TrainingcampFacade();
			trainingcampFacade.facade = this;
			trainingcampFacade.initializeController();
			/**********科技馆********/
			var techBarFacade :TechBarFacade = new TechBarFacade();
			techBarFacade.facade = this;
			techBarFacade.initializeController();
			/**********联赛********/
			var leagueMatchFacade :LeagueMatchFacade = new LeagueMatchFacade();
			leagueMatchFacade.facade = this;
			leagueMatchFacade.initializeController();
			//球场
			var courtFacade:CourtFacade = new CourtFacade();
			courtFacade.facade = this;
			courtFacade.initializeController();
			/*聊天*/
			var chatFacade:ChatFacade = new ChatFacade();
			chatFacade.facade = this;
			chatFacade.initializeController();
			/*好友 **/
			var fFacade:FriendFacade = new FriendFacade();
			fFacade.facade = this;
			fFacade.initializeController();
			//探索
			var eFacade:ExploreFacade = new ExploreFacade();
			eFacade.facade = this;
			eFacade.initializeController();
			//天梯赛
			var ladderFacade:LadderMatchFacade = new LadderMatchFacade();
			ladderFacade.facade = this;
			ladderFacade.initializeController();
			//商城
			var shopFacade:ShopFacade = new ShopFacade();
			shopFacade.facade = this;
			shopFacade.initializeController();
			//任务
			var taskFacade:TaskFacade = new TaskFacade();
			taskFacade.facade = this;
			taskFacade.initializeController();
			//国家挑战赛
			var contryFacade:CompeteFacade = new CompeteFacade();
			contryFacade.facade = this;
			contryFacade.initializeController();
			//活动
			var activityFacade:ActivityFacade = new ActivityFacade();
			activityFacade.facade = this;
			activityFacade.initializeController();
			//排行
			var ranklistFacade:RankinglistFacade = new RankinglistFacade();
			ranklistFacade.facade = this;
			ranklistFacade.initializeController();
			//竞猜
			var guessFacade :GuessFacade = new GuessFacade();
			guessFacade.facade = this;
			guessFacade.initializeController();
			//黄金12宫
			var goldPalaceFacade :GoldPalaceFacade = new GoldPalaceFacade();
			goldPalaceFacade.facade = this;
			goldPalaceFacade.initializeController();
			//荣誉堂
			var fameHallFacade :FameHallFacade = new FameHallFacade();
			fameHallFacade.facade = this;
			fameHallFacade.initializeController();
			//天赋
			var talentFacade:TalentFacade = new TalentFacade();
			talentFacade.facade = this;
			talentFacade.initializeController();
		}
		/**
		 *启动MVC，主程序中调用此方法
		 * 	* @param myApp 
		 */			
		public function startUp():void
		{
			this.sendNotification(STARTUP);
		}
	}
}